#pragma once
#include "EDAABB.h"
#include "matrix4.h"
#include <queue>
#include <vector>

#include "Condition.h"
//#include "Action.h"
#include "Object.h"

//#include "SGKAgent.h" // I am before all things.
class SGKAgent;
class Action;

#define TIME_MOD 0.85f

class God
{
private:	
	Condition * world_conditions;
	std::vector<Object> m_objects;

	God();

	float time_mod;

	~God()/*{}  no heretics here, sir.																																																	*/ {delete [] world_conditions;}/*
										*/

public:
	static God * GetInstance(void){static God m_Himself; return &m_Himself;} // What if God was sin gle ton?
																			 // Just a bit-stream on the bus
	Condition * const Conditions(conditionID enumeration){if (enumeration >= 0 && enumeration < NONE){return &(world_conditions[enumeration]);} else return 0;}

	value EvaluateCondition(SGKAgent * regarding, Condition & condition);
	bool EvaluateAction(SGKAgent * regarding, Action * act);

	float GetTimeMod(){return time_mod;}
	void ModTimeMod(float mod){time_mod += mod; if (time_mod <= 0.0f) time_mod = 0.01f;}

	void DrawObjects(void);

	int findGun(void);
	bool isObjAtLoc(vec3f pos, OBJID id);
	value GetObjAtLoc(vec3f pos);

	Object * GetObject(int obj_id);

	int findMeA(OBJID id);

};